#encoding:utf8

"""
parse the literal parameters like 'year=2016, month="*/3"'

TODO:
    1, add defined-format variables like ${bizdate}

"""


def parse_parameter(s):
    s = format_parameter(s)
    literal = "dict({0})".format(s)
    return eval(literal)


def format_parameter(s):
    return s.replace(';', ',').\
            replace(":", "=")


def test():
    s = "year=\"2016\""
    print parameter_parse(s)
    s = "year=2016, month='*/5', day=20"
    print parameter_parse(s)

if __name__ == "__main__":
    test()
